package com.spring.campus_express_delivery.controller;

import com.google.gson.Gson;
import com.qiniu.common.QiniuException;
import com.qiniu.http.Response;
import com.qiniu.storage.Configuration;
import com.qiniu.storage.Region;
import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.util.Auth;
import com.spring.campus_express_delivery.entity.Users;
import com.spring.campus_express_delivery.exception.Result;
import com.spring.campus_express_delivery.util.JwtToken;
import com.spring.campus_express_delivery.util.MyUtil;
import com.spring.campus_express_delivery.util.ResponseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
@CrossOrigin
@Controller
@RequestMapping("/test")
@Api(value = "TestObject", description = "测试")
public class TestObject {
    /**
     * 修改自己信息接口
     * @return
     * @throws IOException
     */
    @ApiOperation("对象存储文件测试")
    @PostMapping("/web/test_update_info")
    @ResponseBody
    public String testUpdateUserInfoByMyself(@RequestParam(required = false) MultipartFile pictureFile) throws IOException, ParseException {
        String pic = MyUtil.testPrint(pictureFile);
        return pic;
    }

    /**
     * 统一异常处理测试
     * @return
     */
    @ApiOperation("统一异常处理测试")
    @GetMapping("/exceptionTest")
    @ResponseBody
    public Result<String> demo() {
        int a=1/0;
        return Result.success("hello " );
    }
}
